package com.imooc.distributedsesssion;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description :
 * @Author : YTY
 * @Date : 2021-02-07 16:04
 */

@Configuration
public class WebMvcConfig implements WebMvcConfigurer{

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/user/address")   //  /user/**  全拦截
                .addPathPatterns("/user/infoWithJwt");

//        registry.addInterceptor(loginInterceptor)
//                .addPathPatterns("/user/**")    // 除获取JWT接口外，其余全部拦截
//                .excludePathPatterns("/user/loginWithJwt");
    }
}
